package com.lovo.csc.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lovo.csc.bean.OrderInfoBean;
import com.lovo.csc.service.IOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("orderInfo")
public class OrderInfoController {
    @Autowired
    private IOrderInfoService orderInfoService;

    /**
     * 提供给后端供应商退货的远程接口，修改状态为3--待退货
     * @param idNum
     * @return
     */
    @GetMapping("updateStatusTo3/{idNum}")
    public String updateStatusTo3(@PathVariable("idNum") String idNum){
        orderInfoService.updateStatusTo3(idNum);
        return "ok";
    }

    @GetMapping("findAll3/{pageNO}")
    public IPage<OrderInfoBean> findAll3(@PathVariable("pageNO") int pageNO){
        return orderInfoService.findAll3(pageNO);
    }

    /**
     * 修改审核通过或审核不通过的批次记录状态4--已退货
     * @param
     * @return
     */
    @GetMapping("updateStatusTo4/{idNum}")
    public String updateStatusTo4(@PathVariable("idNum") String idNum){
        orderInfoService.updateStatusTo4(idNum);
        return "ok";
    }
}
